﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HCQ2_Model.APPModel.ParamModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;

namespace HCQ2_Model
{
    /// <summary>
    ///  体验排行模型
    /// </summary>
    public class ExperienceRankModel: BaseAPI
    {
        public int er_id { get; set; }
        public int user_id { get; set; }
        public string user_name { get; set; }
        [Required]
        public int file_id { get; set; }
        public string file_name { get; set; }
        [Required(ErrorMessage = "folder_name：体验项目必填项")]
        public string folder_name { get; set; }
        public string em_time { get; set; }
        public decimal? score { get; set; }
        public string in_date { get; set; }
        public string out_date { get; set; }
        /// <summary>
        ///  头像
        /// </summary>
        public string user_header { get; set; }

        public T_VRExperienceRank ToEntity()
        {
            return new T_VRExperienceRank
            {
                user_id = this.user_id,
                user_name = this.user_name,
                file_id = this.file_id,
                file_name = this.file_name,
                folder_name = this.folder_name,
                in_date = DateTime.ParseExact(this.in_date, "yyyyMMddHHmmss", CultureInfo.CurrentCulture, DateTimeStyles.None),
                out_date = DateTime.ParseExact(this.out_date, "yyyyMMddHHmmss", CultureInfo.CurrentCulture, DateTimeStyles.None),
                em_time = this.em_time,
                score = this.score
            };
        }
    }
    public partial class T_VRExperienceRank
    {
        public ExperienceRankModel ToPOCO()
        {
            return new ExperienceRankModel
            {
                er_id = this.er_id,
                user_id = this.user_id,
                user_name = this.user_name,
                file_id = this.file_id,
                file_name = this.file_name,
                folder_name = this.folder_name,
                em_time = this.em_time,
                in_date = this.in_date.ToString("yyyy-MM-dd HH:mm"),
                out_date = (this.out_date != null) ? this.out_date.ToString("yyyy-MM-dd HH:mm") : "",
                score = this.score
            };
        }
    }
}
